<?php

namespace App\Models\Applet\User;

class UserSponsorImgModel extends BaseUserModel
{
    protected $table = 'user_sponsor_img';

    /**
     * 根据用户认养id查询数据
     * @param int $userSponsorId
     * @param array $fields
     * @return array
     */
    public function getItemByUserSponsorId(int $userSponsorId, array $fields = self::QUERY_DEFAULT_FIELDS): array
    {
        return $this->select($fields)
                    ->where('user_sponsor_id', $userSponsorId)
                    ->where('deleted', self::DELETED_NO)
                    ->get()
                    ->toArray();
    }

    /**
     * 根据用户认养ids查询数据
     * @param array $userSponsorIds
     * @param array $fields
     * @return array
     */
    public function getItemsByUserSponsorIds(array $userSponsorIds, array $fields = self::QUERY_DEFAULT_FIELDS): array
    {
        return $this->select($fields)
                    ->whereIn('user_sponsor_id', $userSponsorIds)
                    ->where('deleted', self::DELETED_NO)
                    ->get()
                    ->toArray();
    }
}
